/*
 *  Copyright 2009 Matthieu Chase Heimer
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.

 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.

 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
package com.macro10.xroads.commands;

import com.macro10.switchboard.AbstractCommand;
import com.macro10.switchboard.Session;
import com.macro10.xroads.entity.Area;
import com.macro10.xroads.entity.Avatar;
import com.macro10.xroads.entity.Exit;
import java.util.List;

public class AbstractMoveCommand extends AbstractCommand {

    protected void showArea(Session session, Area area, Avatar avatar) {
        session.writeText("area:" + area.getAreaName());
        StringBuilder line = new StringBuilder();
        List<Avatar> avatars = area.getAvatarsExcept(avatar.getAvatarId());
        line.append("avatars:");
        for (int i = 0; i < avatars.size(); i++) {
            Avatar a = avatars.get(i);
            line.append(a.getAvatarId());
            line.append("|");
            line.append(a.getObject("gender"));
            line.append("|");
            line.append(a.getObject("element"));
            if (i < (avatars.size() - 1)) {
                line.append(",");
            }
        }
        session.writeText(line);
        line.setLength(0);
        line.append("npcs:");
        session.writeText(line);
        line.setLength(0);
        line.append("monsters:");
        session.writeText(line);
        line.setLength(0);
        line.append("items:");
        session.writeText(line);
    }

    protected void showAvatarExit(Session session, Area area, Exit exit, Avatar avatar, String msgKey) {
    }

    protected void showAvatarEntrance(Session session, Area exited, Area entered, Avatar avatar, String msgKey) {
    }
}
